<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />

		<link href="../../cssmui/mui.min.css" rel="stylesheet" />
		<link href="../../css/app.css" rel="stylesheet" />
		<!--App自定义的css-->
		<script src="../../mui/mui.min.js"></script>
		<script src="../../mui/common.js"></script>
		<script src="../../js/vue.min.js"></script>
		<script src="../../js/app.js"></script>
		
		<script src="../../js/test.menu.data.js" type="text/javascript" charset="utf-8"></script>
		<script src='../../js/template-web.js'></script>
		<script src="../../js/loadtmpl.js"></script>
		<script src="../../js/zdyfile.js"></script>
		<script src="../../js/mysimg.js"></script>
		<script src="../../js/jsondb.js"></script>
		<!--标准mui.css-->
		<style type="text/css">
			.input70 {
				width: 70%;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">产品信息</h1>
			<button id="scanBtn" onclick="clicked('../../plus/barcode_scan.html',true,true)" class="mui-pull-right myheadBtn" type="button" onclick="return false; ">扫描</button>
		</header>
		<div class="mui-content">
			<div class="mui-collapse-content ">
				<div class="mui-row">
					<div id="slider " class=" mui-slider ">
						<div id="divphotos" class="mui-slider-group">
						<div v-for="(item,index) in imgs" class="mui-slider-item img-btn">						
							<img class="sliderimg" onload="imgLoaded(this)" v-on:click="onclick(event)"  :src="item.src">
						</div>
					</div>
					</div>
				</div>
				<form class="mui-input-group">
					<ul class="mui-table-view">
						<li id="prod_div" class="mui-table-view-cell ">
						</li>
						<li class="mui-table-view-cell mui-collapse ">
							<a class="mui-navigate-right " href="# ">使用说明</a>
							<div class="mui-collapse-content " style="padding: 0px;">
								<textarea id="gnote" rows="13" style="margin:0px" placeholder="非必填,多行文本框"></textarea>
							</div>
						</li>
					</ul>
				</form>
				<nav class="mui-bar mui-bar-tab">
					<a class="mui-tab-item" href="edit">
						<span class="mui-tab-label">修改</span>
					</a>
				</nav>
			</div>

			<script type="text/javascript">
				var targetTab = ['goods_info.html']
				var _tb_goods = null
				var _curid = '';
				var _rs = null;
				mui.ready(function() {
					//loadDataById() //测试用 正式时去掉
					document.querySelector('.mui-slider').addEventListener('slide', function(event) {
						//注意slideNumber是从0开始的；						
						_si.setIndex(event.detail.slideNumber);
					});
				
					mui("nav").on("tap", ".mui-tab-item", function() {
						var eventname = this.getAttribute("href")
						if(eventname == "edit") {
							mui.openWindow({
								url: targetTab[0],
								id: targetTab[0],
								extras: {
									selectedid: _curid
								}, //自定义扩展参数，可以用来处理页面间传值
								createNew: false //是否重复创建同样id的webview，默认为false:不重复创建，直接显示
							});
						}
					});

					window.addEventListener('bechanged', function(e) {　 //获取参数值					
						if(e.detail.reload == 1) {
						
							//console.log('102_curid'+_curid)
							loadDataById(_curid)
							_reload = 1
						}
					});
				});
				var DICT_gclass = null;
				//---------------字典载入--------------------
				function loaddict() {
					var tbtyps = new XCDBHelp('tb_types')
					var obj = tbtyps.getObjByID('gclass')
					if(obj == null) return;
					DICT_gclass = obj._data

				}

				function afterPlusReady() {
					_tb_goods = new XCDBHelp('tb_goods')
					_si = new SliderImage("divphotos");
					var self = _self;
					if(self.selectedid == null) return;
					_curid = self.selectedid;
					//console.log('curid;'+curid)
					//console.log('si;'+_si)
					loaddict();
					loadDataById(_curid)
				}

			

				function loadDataById(id) {

					//					 rs = {
					//						gid: '物品编号132492304583064',
					//						gname: '物品名称保湿霜保湿霜保湿霜保湿霜保湿霜保湿霜',
					//						gclass: '物品分类保湿霜',
					//						spec: '单位规格型号8929*9292ml',
					//						weight: '单位重量',
					//						cbcm: '单位体积',
					//						gaddr: '产地黑龙江黑龙江黑龙江',
					//						price1: '最低价10.00',
					//						price2: '最高价20.00',
					//						gnote: '说明',
					//						gimg: '',
					//						quality: '保质期',
					//						status: '状态'
					//					};
					//data.库存 = '90'
					//log(id,'ccccccc')
					_rs = _tb_goods.getObjByID(id)
					if(_rs) {
						var data = _rs;
						//log(data)
						plus.nativeUI.showWaiting("处理中");
						data.gclass = _FF.ToM(data.gclass, DICT_gclass).text
						loadTpl2Div('prod2_tpl', data, 'prod_div');
						_FF.putV('gnote', data.gnote);
						_si.loadImgs(data.gimg);
						plus.nativeUI.closeWaiting();
					}
				}

				//配合扫描器 的回调函数
				function scaned(type, result, file) {
					//_FF.putV('gid', result);
					//result = '2';
					loadDataById(result)
				}
			</script>
	</body>

</html>